﻿using System;
using UnityEngine;

// Token: 0x02000136 RID: 310
public class CameraTarget : MonoBehaviour
{
	// Token: 0x060006FD RID: 1789 RVA: 0x0002941C File Offset: 0x0002761C
	private void Awake()
	{
		this.renderer = base.GetComponent<Renderer>();
		if (this.cam == null)
		{
			this.cam = Camera.main;
		}
		this.rotOffset = Quaternion.Euler(this.rotOffsetEuler);
		this.pos = base.transform.position;
		this.state = CameraTarget.STATE.NONE;
		Color color = this.renderer.material.color;
		color.a = 0f;
		this.renderer.material.color = color;
	}

	// Token: 0x060006FE RID: 1790 RVA: 0x000294A8 File Offset: 0x000276A8
	private void Start()
	{
	}

	// Token: 0x060006FF RID: 1791 RVA: 0x000294AC File Offset: 0x000276AC
	public void Move(Vector3 setPos, bool show)
	{
		this.pos = setPos;
		if (show)
		{
			this.state = CameraTarget.STATE.MOVE;
		}
	}

	// Token: 0x06000700 RID: 1792 RVA: 0x000294C4 File Offset: 0x000276C4
	private void LateUpdate()
	{
		base.transform.position = this.pos;
		base.transform.rotation = this.cam.transform.rotation * this.rotOffset;
		if (this.state == CameraTarget.STATE.MOVE)
		{
			this.ChangeAlpha(Mathf.Min(this.renderer.material.color.a + Time.deltaTime * this.AlphaInSpeed, 1f));
			this.state = CameraTarget.STATE.STOP;
		}
		else if (this.state == CameraTarget.STATE.STOP)
		{
			this.ChangeAlpha(Mathf.Max(this.renderer.material.color.a - Time.deltaTime * this.AlphaInSpeed, 0f));
			if (this.renderer.material.color.a <= 0f)
			{
				this.state = CameraTarget.STATE.NONE;
			}
		}
	}

	// Token: 0x06000701 RID: 1793 RVA: 0x000295C0 File Offset: 0x000277C0
	private void ChangeAlpha(float alpha)
	{
		Color color = this.renderer.material.color;
		color.a = alpha;
		this.renderer.material.color = color;
	}

	// Token: 0x040006EC RID: 1772
	public Camera cam;

	// Token: 0x040006ED RID: 1773
	public float AlphaInSpeed = 5f;

	// Token: 0x040006EE RID: 1774
	public float AlphaOutSpeed = 5f;

	// Token: 0x040006EF RID: 1775
	public Vector3 rotOffsetEuler;

	// Token: 0x040006F0 RID: 1776
	private Quaternion rotOffset;

	// Token: 0x040006F1 RID: 1777
	private Vector3 pos;

	// Token: 0x040006F2 RID: 1778
	private Renderer renderer;

	// Token: 0x040006F3 RID: 1779
	private CameraTarget.STATE state;

	// Token: 0x02000137 RID: 311
	private enum STATE
	{
		// Token: 0x040006F5 RID: 1781
		NONE,
		// Token: 0x040006F6 RID: 1782
		MOVE,
		// Token: 0x040006F7 RID: 1783
		STOP
	}
}
